package cn.highset.modules.base.entity;

import cn.highset.base.HighsetBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author Victor
 */
@Data
@Entity
@Table(name = "t_product_type")
@TableName("t_product_type")
@SQLDelete(sql = "update t_product_type set del_flag= 1 where id =?")
@SQLDeleteAll(sql = "update t_product_type set del_flag= 1 where id =?")
@Where(clause = "del_flag=0")
@ApiModel(value = "产品类别")
public class ProductType extends HighsetBaseEntity {

    private static final long serialVersionUID = 1L;


    @ApiModelProperty(value = "上级id")
    private String parentId;

    @ApiModelProperty(value = "所有的上级id")
    private String parentIds;
    @ApiModelProperty(value = "中文名称")
    private String nameCn;
    @ApiModelProperty(value = "英文名称")
    private String nameEn;

    @ApiModelProperty(value = "层级")
    private Integer levels;

    @ApiModelProperty(value = "排序值")
    @Column(precision = 10, scale = 2)
    private BigDecimal sortOrder;


    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "父节点名称")
    private String parentTitle;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "节点名称")
    private String title;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "子类别")
    private List<ProductType> children;
}
